﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PhamHoangDuy_KiemTra_1251tt1437.DAL;

namespace PhamHoangDuy_KiemTra_1251tt1437.BLL
{
    class NHACCUNGCAPBLL
    {
        DataClasses1DataContext DB = new DataClasses1DataContext();
        public List<NHACCUNGCAP> listNhaCungCap()
        {
            List<NHACCUNGCAP> list = DB.NHACCUNGCAPs.ToList();
            return list;
        }

        public void insert(string maccc, string tenccc, string diachi, string dienthoai, string email, string thanhpho)
        {
            NHACCUNGCAP sp = new NHACCUNGCAP();
            sp.Mancc = maccc;
            sp.Tencc = tenccc;
            sp.DiaChi = diachi;
            sp.DienThoai = dienthoai;
            sp.Email = email;
            sp.ThanhPho = thanhpho;

            DB.NHACCUNGCAPs.InsertOnSubmit(sp);
            DB.SubmitChanges();
        }

        public void delete(string msp)
        {
            NHACCUNGCAP sp = DB.NHACCUNGCAPs.Where(p => p.Mancc == msp).FirstOrDefault();
            DB.NHACCUNGCAPs.DeleteOnSubmit(sp);
            DB.SubmitChanges();
        }


    }
}
